/*
 * 编程实现一个输入指定范围内的整数的函数（4分）
 */

#include <stdio.h>

int getint(int min, int max) {
	int input;

	do {
		printf("Please enter an integer [%d..%d]:\n", min, max);
		scanf("%d", &input);
	} while (input < min || input > max);

	return input;
}

int main() {
	setbuf(stdout, NULL);

	int min, max;

	printf("Please enter min,max:\n");
	scanf("%d,%d", &min, &max);

	printf("The integer you have entered is:%d", getint(min, max));

	return 0;
}
